package com.sky.mapper;

import com.sky.anotion.AutoFill;
import com.sky.anotion.AutoId;
import com.sky.entity.LogicFlow;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface LogicFlowMapper {
    @AutoId
    @AutoFill(OperationType.INSERT)
    @Insert("insert into loficflow (id, data,category_id, create_time, update_time, create_user, update_user) " +
            "values (#{id}, #{data},#{categoryId}, #{createTime}, #{updateTime}, #{createUser}, #{updateUser})")
    void add(LogicFlow logicFlow);

    @AutoFill(OperationType.UPDATE)
    @Update("update loficflow set data = #{data}, update_time = #{updateTime}, update_user = #{updateUser} where id = #{id}")
    void update(LogicFlow logicFlow);

    @Select("select * from loficflow where id = #{id}")
    LogicFlow getById(String id);
    @Select("select * from loficflow where category_id = #{id}")
    LogicFlow getByCategoryId(String id);

    void deleteByCategoryId(List<String> ids);
}
